package com.imooc.authorization.context;

import com.imooc.authorization.entity.User;

/**
 * Created by Administrator on 2016/8/18.
 */
public class UserContext {

    private static ThreadLocal<UserContext> tl=new ThreadLocal<>();

    private User user;


    private UserContext(User user){

        this.user=user;
    }

    static void setCurrent(User user){
        tl.set(new UserContext(user));

    }

    public static UserContext getCurrent(){

        return tl.get();
    }

    public User getUser(){
        return user;
    }
}
